package org.example.day20240904;

import com.mysql.jdbc.Driver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class MainDelete {
    public static void main(String[] args) throws SQLException {
        Connection connection = JDBCUtils.getConnection();

        String sql = "delete from t_user where name = ?";

        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setString(1,"xiaohong");
//        preparedStatement.setString(2,"2000-03-05");
        int affected_rows = preparedStatement.executeUpdate();
        System.out.println(affected_rows);
        JDBCUtils.close(connection,preparedStatement);
    }
}
